package com.example.drawboard.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Path;
import android.util.AttributeSet;
import android.widget.ImageView;

public class CircleImageView extends ImageView {

    private int paint_width = 1;
    public CircleImageView(Context context) {
        super(context);
    }

    public CircleImageView(Context context, AttributeSet attrs) {

        super(context, attrs);
    }

    public void setPaint_width(int paint_width) {
        this.paint_width = paint_width;
        invalidate();
    }

    @Override
    protected void onDraw(Canvas canvas) {
        Path path = new Path();
        path.addCircle(getWidth()/2,getHeight()/2,paint_width, Path.Direction.CCW);
        canvas.clipPath(path);
        super.onDraw(canvas);
    }
}
